package com.unit4;

import java.util.HashMap;

/**
 * @author 李琦 on 2021/8/9.
 * @version java version "16.0.1" 2021-04-20
 * Map集合,key不可以重复(后存入的会覆盖)
 */
public class test27 {
    public static void main(String[] args) {
        HashMap hm=new HashMap();
        hm.put("1001","李琦");//put("key","value")键值对应
        hm.put("1002","李琦琦");
        hm.put("1003","李琦琦琦");
        hm.put("1004","李琦琦琦琦");
        System.out.println(hm.get("1002"));//根据键获取值

        hm.remove("1002");//删除键值对
        System.out.println(hm.size());

    }
}
